package com.ruoyi.web.controller.control;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.control.domain.Inclinedshaft;
import com.ruoyi.control.service.IInclinedshaftService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 斜井提升Controller
 *
 * @author ruoyi
 * @date 2024-12-20
 */
@RestController
@RequestMapping("/inclinedshaft/inclinedshaft")
public class InclinedshaftController extends BaseController
{
    @Autowired
    private IInclinedshaftService inclinedshaftService;

    /**
     * 查询斜井提升列表
     */
    @PreAuthorize("@ss.hasPermi('inclinedshaft:inclinedshaft:list')")
    @GetMapping("/list")
    public TableDataInfo list(Inclinedshaft inclinedshaft)
    {
        startPage();
        List<Inclinedshaft> list = inclinedshaftService.selectInclinedshaftList(inclinedshaft);
        return getDataTable(list);
    }

    /**
     * 导出斜井提升列表
     */
    @PreAuthorize("@ss.hasPermi('inclinedshaft:inclinedshaft:export')")
    @Log(title = "斜井提升", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Inclinedshaft inclinedshaft)
    {
        List<Inclinedshaft> list = inclinedshaftService.selectInclinedshaftList(inclinedshaft);
        ExcelUtil<Inclinedshaft> util = new ExcelUtil<Inclinedshaft>(Inclinedshaft.class);
        util.exportExcel(response, list, "斜井提升数据");
    }

    /**
     * 获取斜井提升详细信息
     */
    @PreAuthorize("@ss.hasPermi('inclinedshaft:inclinedshaft:query')")
    @GetMapping(value = "/{tagName}")
    public AjaxResult getInfo(@PathVariable("tagName") String tagName)
    {
        return success(inclinedshaftService.selectInclinedshaftByTagName(tagName));
    }

    /**
     * 新增斜井提升
     */
    @PreAuthorize("@ss.hasPermi('inclinedshaft:inclinedshaft:add')")
    @Log(title = "斜井提升", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Inclinedshaft inclinedshaft)
    {
        return toAjax(inclinedshaftService.insertInclinedshaft(inclinedshaft));
    }

    /**
     * 修改斜井提升
     */
    @PreAuthorize("@ss.hasPermi('inclinedshaft:inclinedshaft:edit')")
    @Log(title = "斜井提升", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Inclinedshaft inclinedshaft)
    {
        return toAjax(inclinedshaftService.updateInclinedshaft(inclinedshaft));
    }

    /**
     * 删除斜井提升
     */
    @PreAuthorize("@ss.hasPermi('inclinedshaft:inclinedshaft:remove')")
    @Log(title = "斜井提升", businessType = BusinessType.DELETE)
	@DeleteMapping("/{tagNames}")
    public AjaxResult remove(@PathVariable String[] tagNames)
    {
        return toAjax(inclinedshaftService.deleteInclinedshaftByTagNames(tagNames));
    }
}
